package com.glodon.paas.databag.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import com.glodon.paas.databag.model.Thumbnail;

@Repository
public interface ThumbnailRepository extends CrudRepository<Thumbnail, String> {
    
    public List<Thumbnail> findByDatabagIdAndSize(String databagId, String size);
    
    public List<Thumbnail> findByDatabagIdOrderBySizeAsc(String databagId);

    @Modifying
    @Query("delete from Thumbnail t where t.databagId=?1")
    public void deleteThumbnails(String databagId);
}
